﻿@using Xoohoo.Configuration
@using System.Configuration
@{
    Layout = "../Shared/_InnerPage.cshtml";
}
@model XoohooViewModelItem<XoohooConfigurationSection>
@section TitleContent{
    @Html.SiteTitle("系统管理", "模块信息")
}
@{
    XoohooConfigurationSection config = Model.Item;
}
@{
    WriteLiteral(
       Html.Grid(config.Modules.Cast<XoohooModuleConfigurationElement>()).Columns(column =>
       {
           column.For(item => item.Name).Named("模块配置名称").HeaderAttributes(@class => "tit120").Attributes(@class => "con120");
           column.For(item => item.Type).Named("类型").HeaderAttributes(@class => "titOth").Attributes(@class => "conOth");
           column.For(item => item.Skin).Named("皮肤").HeaderAttributes(@class => "titOth").Attributes(@class => "conOth");
           column.For(item => item.DataProvider).Named("数据代理").HeaderAttributes(@class => "tit80").Attributes(@class => "con80");
           column.For(item => item.Enabled.ToChinese()).Named("是否启用").HeaderAttributes(@class => "tit60").Attributes(@class => "con60");
       })
        //表格属性
.Attributes(@class => "tbl")
        //表头行属性
.HeaderRowAttributes(new Hash(@class => "rowhead"))
        //列表行属性
.RowAttributes(data => new Hash(@class => "{0}".FormatWith(data.IsAlternate ? "rowodd" : "")))
    );
}
<br />
@{
    WriteLiteral(
    Html.Grid(config.Providers.Cast<XoohooDataProviderConfigurationElement>()).Columns(column =>
    {
        column.For(item => item.Name).Named("数据代理名称").HeaderAttributes(@class => "tit120").Attributes(@class => "con120");
        column.For(item => item.Type).Named("类型").HeaderAttributes(@class => "titOth").Attributes(@class => "conOth");
        column.For(item => item.ConnectionString).Named("数据库链接配置").HeaderAttributes(@class => "tit120").Attributes(@class => "con120");
        column.For(item => item.Enabled.ToChinese()).Named("是否启用").HeaderAttributes(@class => "tit60").Attributes(@class => "con60");
    })
        //表格属性
    .Attributes(@class => "tbl")
        //表头行属性
    .HeaderRowAttributes(new Hash(@class => "rowhead"))
        //列表行属性
    .RowAttributes(data => new Hash(@class => "{0}".FormatWith(data.IsAlternate ? "rowodd" : "")))
    );
}
<br />
@{
    var webConfigConnectionStrings = ConfigurationManager.ConnectionStrings.Cast<ConnectionStringSettings>();
    var xoohooConnectionStrigns = config.ConnectionStrings.Cast<ConnectionStringSettings>();
    var connectionStrings = (from s in webConfigConnectionStrings
                             select s
                            )
                             .Union(
                             from s in xoohooConnectionStrigns
                             select s
                            );
    WriteLiteral(
        Html.Grid(connectionStrings).Columns(column =>
        {
            column.For(item => item.Name).Named("数据库链接配置名称").HeaderAttributes(@class => "tit120").Attributes(@class => "con120");
            column.For(item => item.ConnectionString).Named("链接字符串").HeaderAttributes(@class => "titOth").Attributes(@class => "conOth");
            column.For(item => item.ProviderName).Named("数据代理").HeaderAttributes(@class => "tit120").Attributes(@class => "con120");
        })
        //表格属性
.Attributes(@class => "tbl")
        //表头行属性
.HeaderRowAttributes(new Hash(@class => "rowhead"))
        //列表行属性
.RowAttributes(data => new Hash(@class => "{0}".FormatWith(data.IsAlternate ? "rowodd" : "")))
        );
}
